package com.xiaoshuidi.cloud.module.contract.api;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.contract.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.contract.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.SERVERNAME)
public interface ContractApi {

    /**
    * 审批通过 和审批驳回 修改合同状态
    * */
    @PostMapping(ApiConstants.PREFIX + "/update-Contract")
    CommonResult<Long> updateContractStatus(@RequestBody ApproveReqVO reqVO);

    /**
     * 客户手机号 和合同状态查询 租客合同
     * */
    @GetMapping(ApiConstants.PREFIX + "/get-Contract-Phone")
    CommonResult<List<ContractRoomRespVO>> getContractPhone(@RequestParam("phone")String phone,
                                                            @RequestParam("contractStatus")List<String> contractStatus);

    /**
     * 通过房间id获取租客memberId与租客类型
     * @param roomId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-member-id-by-room-id")
    CommonResult<CustomerVO> getContractMemberIdByRoomId(@RequestParam Long roomId);


    /**
     * 通过房间id获取租客信息
     * @param roomId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-member-info-by-room-id")
    CommonResult<RenterVO> getContractRenterInfoByRoomId(@RequestParam Long roomId);


    /**
     * 通过房间id获取租客信息list
     * @param roomId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-member-list-by-room-id")
    CommonResult<RenterVO1> getContractRenterListByRoomId(@RequestParam Long roomId);


    /**
     * 通过房间id获取租客信息
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-roomIds")
    CommonResult<List<ContractRoomReqVO>> getRoomIdByUserId();

    @GetMapping(ApiConstants.PREFIX + "/get-roomIds-by-memberId")
    CommonResult<List<ContractRoomReqVO>> getRoomIdByUserId(@RequestParam("memberId") Long memberId);

    @GetMapping(ApiConstants.PREFIX + "/get-roomIds-by-companyId")
    CommonResult<List<ContractRoomReqVO>> getRoomIdByCompanyId(@RequestParam("companyId") Long companyId);

    @PostMapping(ApiConstants.PREFIX + "/update-renting-out-contract-status")
    CommonResult<Long> updateRentingOutContractStatus(@RequestBody ApproveReqVO reqVO);

    @GetMapping(ApiConstants.PREFIX + "/get-apartment")
    CommonResult<ContractRoomReqVO> getRoomIdByApartment(@RequestParam Long memberId);
    /**
     * roomIds 查询 是否有过期未支付的账单
     */
    @GetMapping(ApiConstants.PREFIX + "/get-overdue-unpaid-order")
    CommonResult<List<RentOrderVO>> getOverdueUnpaidOrder();


    /**
     * 房间ID获取同住人信息
     */
    @GetMapping(ApiConstants.PREFIX + "/get-roommate-by-roomId")
    CommonResult<List<ContractRoommateApiVO>> getRoommateByRoomId(@RequestParam("roomId") Long roomId);

    /**
     * 根据门店id查询 有效合同的 的人员id
     */
    @GetMapping(ApiConstants.PREFIX + "/get-member-by-apartmentId")
    CommonResult<List<Long>> getMemberIdsByApartmentId(@RequestParam("apartmentId") Long apartmentId);

    /**
     * 根据门店ids查询 有效合同的 的人员id
     */
    @PostMapping(ApiConstants.PREFIX + "/get-member-by-apartmentIds")
    CommonResult<List<Long>> getMemberIdsByApartmentIds(@RequestBody List<Long> apartmentIds);

    /**
     * 房间ID查询当前合同信息
     */
    @GetMapping(ApiConstants.PREFIX + "/get-contract-by-roomId")
    CommonResult<RoomContractApiRespVO> getContractByRoomId(@RequestParam("roomId") Long roomId);

    @PostMapping(ApiConstants.PREFIX + "/get-contact-by-room-ids")
    CommonResult<List<RoomContractApiRespVO>> getContractByRoomIds(@RequestBody List<Long> roomIds);

    /**
     * 会员id获取合同信息
     *
     * @param memberId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-all-contract-by-memberId")
    CommonResult<List<ContractRoomReqVO>> getAllContractByUserId(@RequestParam("memberId") Long memberId);


    /**
     * 会员id获取合同信息
     *
     * @param memberId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-all-contract-by-roomMateUserId")
    CommonResult<List<ContractRoomReqVO>> getAllContractByRoomMateUserId(@RequestParam("memberId") Long memberId);

    /**
     * 企业id获取合同信息
     *
     * @param companyId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-all-contract-by-companyId")
    CommonResult<List<ContractRoomReqVO>> getAllContractByCompanyId(@RequestParam("companyId") Long companyId);

    /**
     * 企业id和房源id获取合同信息
     *
     * @param companyId
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-all-contract-by-companyId-and-roomId")
    CommonResult<List<ContractRoomReqVO>> getAllContractByCompanyIdAndRoomId(@RequestParam("companyId") Long companyId, @RequestParam("roomId") Long roomId);

    /**
     * 通过房间id获取租客信息（新）
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-room-data")
    CommonResult<List<ContractRoomReqVO>> getRoomDataIdByUserId(@RequestParam("memberId") Long memberId);


    /**
     * 合同id查询最后一份续租合同
     */
    @GetMapping(ApiConstants.PREFIX + "/get-renewal-contract-by-contractId")
    CommonResult<RoomContractApiRespVO> getRenewalContractByContractId(@RequestParam("contractId") Long contractId);


    /**
     * 根据member_id查询企业入住、同住人，个人承租人的合同信息
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-contact-by-member-id")
    CommonResult<List<ContractRoomReqVO>> getContractByMemberId(@RequestParam("memberId") Long memberId);

    /**
     * 获取企业合同详情
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-company-customer-byId")
    CommonResult<CompanyInfoVO> getCompanyCustomerById(@RequestParam("id") Long id);

    /**
     * 合同号查询合同信息
     */
    @GetMapping(ApiConstants.PREFIX + "/get-contract-by-id")
    CommonResult<ContractRoomRespVO> getContractRoomById(@RequestParam("id") Long id);

    /**
     * 用户查询当前代入住或已入住生效 合同房源信息
     */
    @PostMapping(ApiConstants.PREFIX + "/get-room-name-by-member-ids")
    CommonResult<List<ContractRoomMemberUserVO>> getRoomNameByMemberIds(@RequestBody List<Long> memberIds);

    /**
     * 根据member_id查询入住时长
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-length-of_stay")
    CommonResult<Long> getLengthOfStay(@RequestParam("memberId") Long memberId);

    /**
     * 根据member_id获取是否存在有效合同
     * true 为存在
     * false 不存在
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-person-contract-room-status")
    CommonResult<Boolean> getPersonContractRoomStatus(@RequestParam("memberId") Long memberId);

    /**
     * 已生效合同房间
     * 合同状态为生效中且合同开始时间小于等于今天
     */
    @GetMapping(ApiConstants.PREFIX + "/get-active-contract-rooms")
    CommonResult<List<Long>> getActiveContractRooms(@RequestParam(required = false) Long apartmentId);

    /**
     * 查询杂项列表
     * true 为存在
     * false 不存在
     *
     * @return
     */
    @GetMapping(ApiConstants.PREFIX + "/get-config-fees")
    CommonResult<List<FeesApiVo>> getConfigFees(@RequestParam("tenantId") Long tenantId);

}
